package cn.liyicun.cp.cpweb.mapper;

import cn.liyicun.cp.cpweb.entity.GetApicp;
import cn.liyicun.cp.cpweb.entity.GetApicpExample;
import cn.liyicun.cp.cpweb.entity.GetApicpKey;
import java.io.Serializable;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface GetApicpMapper extends Serializable {
    @SelectProvider(type=GetApicpSqlProvider.class, method="countByExample")
    long countByExample(GetApicpExample example);

    @DeleteProvider(type=GetApicpSqlProvider.class, method="deleteByExample")
    int deleteByExample(GetApicpExample example);

    @Delete({
        "delete from get_apicp",
        "where code = #{code,jdbcType=VARCHAR}",
          "and expect = #{expect,jdbcType=VARCHAR}"
    })
    int deleteByPrimaryKey(GetApicpKey key);

    @Insert({
        "insert into get_apicp (code, expect, ",
        "opentime, name, ",
        "opencode, create_time)",
        "values (#{code,jdbcType=VARCHAR}, #{expect,jdbcType=VARCHAR}, ",
        "#{opentime,jdbcType=TIMESTAMP}, #{name,jdbcType=VARCHAR}, ",
        "#{opencode,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})"
    })
    int insert(GetApicp record);

    @InsertProvider(type=GetApicpSqlProvider.class, method="insertSelective")
    int insertSelective(GetApicp record);

    @SelectProvider(type=GetApicpSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="code", property="code", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="expect", property="expect", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="opentime", property="opentime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="opencode", property="opencode", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<GetApicp> selectByExampleWithRowbounds(GetApicpExample example, RowBounds rowBounds);

    @SelectProvider(type=GetApicpSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="code", property="code", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="expect", property="expect", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="opentime", property="opentime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="opencode", property="opencode", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<GetApicp> selectByExample(GetApicpExample example);

    @Select({
        "select",
        "code, expect, opentime, name, opencode, create_time",
        "from get_apicp",
        "where code = #{code,jdbcType=VARCHAR}",
          "and expect = #{expect,jdbcType=VARCHAR}"
    })
    @Results({
        @Result(column="code", property="code", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="expect", property="expect", jdbcType=JdbcType.VARCHAR, id=true),
        @Result(column="opentime", property="opentime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="opencode", property="opencode", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
    })
    GetApicp selectByPrimaryKey(GetApicpKey key);

    @UpdateProvider(type=GetApicpSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") GetApicp record, @Param("example") GetApicpExample example);

    @UpdateProvider(type=GetApicpSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") GetApicp record, @Param("example") GetApicpExample example);

    @UpdateProvider(type=GetApicpSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(GetApicp record);

    @Update({
        "update get_apicp",
        "set opentime = #{opentime,jdbcType=TIMESTAMP},",
          "name = #{name,jdbcType=VARCHAR},",
          "opencode = #{opencode,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP}",
        "where code = #{code,jdbcType=VARCHAR}",
          "and expect = #{expect,jdbcType=VARCHAR}"
    })
    int updateByPrimaryKey(GetApicp record);
}